const { queryList } = require('../models/stu')
const url = require('url')


const create = (req, res) => {
	res.send('create')

}

const getList = async (req, res) => {

	const parseObj = url.parse(req.url, true);
	// 请求参数解构
	// console.log(parseObj.query);
	// pagesize, pagenum

	let data = await queryList(parseObj.query)
	let result = {
		state: 0,
		data: data.data,
		totalNum: data.totalNum
	};
	res.writeHead(200, { "Content-Type": "application/json;charset=utf-8" });
	res.end(JSON.stringify(result));
}
module.exports = {
	create,
	getList,
}
